package cn.k.controller;

import cn.k.domain.Business;
import cn.k.domain.SystemDictionary;
import cn.k.service.IBusinessService;
import cn.k.service.ISystemDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class indexController {

    @Autowired
    private IBusinessService businessService;

    @Autowired
    private ISystemDictionaryService systemDictionaryService;


    @RequestMapping("/index")
    public String index(Model model){
        Business business= businessService.queryMainStore();
        model.addAttribute("business",business);

        //预约店铺信息的封装
        List<Business> businessesByName = businessService.selectAll();
        model.addAttribute("businessesByName",businessesByName);

        List<SystemDictionary> systemDictionaries= systemDictionaryService.queryByService("business");
        model.addAttribute("systemDictionaries",systemDictionaries);

        return "index";
    }

}
